<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
     
    <title>文件上传swfupload使用</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <link href="<%=basePath%>css/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="<%=basePath%>swfupload/swfupload.js"></script>
    <script type="text/javascript" src="<%=basePath%>swfupload/swfupload.queue.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/fileprogress.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/handlers.js"></script>
     
     
    <script type="text/javascript">
    var swfu;
 
    SWFUpload.onload = function () {
        var settings = {
            flash_url : "<%=basePath%>swfupload/swfupload.swf",
            flash9_url : "<%=basePath%>swfupload/swfupload_fp9.swf",
            upload_url: "<%=basePath%>upload",
            post_params: {
                "hello" : "Here I Am",
                "name" : "张三"
            },
            file_size_limit : "100 MB",
            file_types : "*.*",
            file_types_description : "All Files",
            file_upload_limit : 100,
            file_queue_limit : 0,
            custom_settings : {
                progressTarget : "fsUploadProgress",
                cancelButtonId : "btnCancel"
            },
            debug: true,
            use_query_string : true,//要传递参数，必须配置,可以从后台取到参数,应该还有其他方式，如post方式，未了解
             
            // Button Settings
            button_image_url : "<%=basePath%>images/TestImageNoText_65x29.png",
            button_placeholder_id : "spanButtonPlaceholder",
            button_width: 61,
            button_height: 22,
            button_text: '浏览',
            button_text_style: ".spanButtonPlaceholder { font-size: 12; }",
            button_text_left_padding: 12,
            button_text_top_padding: 3,
 
            // The event handler functions are defined in handlers.js
            //swfupload_preload_handler : preLoad,
            //swfupload_load_failed_handler : loadFailed,
            file_queued_handler : fileQueued,
            file_queue_error_handler : fileQueueError,
            file_dialog_complete_handler : fileDialogComplete,
            upload_start_handler : uploadStart,
            upload_progress_handler : uploadProgress,
            upload_error_handler : uploadError,
            upload_success_handler : uploadSuccess,
            upload_complete_handler : uploadComplete,
            queue_complete_handler : queueComplete  // Queue plugin event
             
        };
 
        swfu = new SWFUpload(settings);
    }
    </script>
  </head>
  <body>
        <div class="fieldset flash" id="fsUploadProgress">
            <span class="legend">文件列表：</span>
            </div>
        <div id="divStatus">上传了0个文件</div>
     
    <div class="flash" id="fsUploadProgress">
    </div>
    <div style="padding-left: 5px;">
        <span id="spanButtonPlaceholder"></span>
        <input id="btnCancel" type="button" value="取消" onclick="cancelQueue(upload);" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;" />
    </div>
     
    <!-- 上传文件列表 -->
    <div class="fileList" id="fileList">
    </div>
     
  </body>
</html>